import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useAuthStore = defineStore(
    'auth-token',
    () => {
        const token = ref('')
        const audioToken = ref('')
        const setToken = (newToken : string) => {
            token.value = newToken
        }
        const removeToken = () => {
            token.value = ''
        }

        const setAudioToken = (newToken: string) => {
            audioToken.value = newToken
        }
        const removeAudioToken = () => {
            audioToken.value = ''
        }

        return {
            token,
            audioToken,
            setToken,
            removeToken,
            setAudioToken,
            removeAudioToken
        }
    },
    {
        persist: true
    }
)
